home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / Dev / GCC / GCC-Install next >
Text File  |  1995-06-14  |  40KB  |  1,368 lines

  1. ;;; -*- Lisp-Interaction -*-
  2. ;;; Version: $VER: GCC-Install 2.6 (26.05.95)
  3. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4. ;;;
  5. ;;;  GNU C Installation script for AmigaDOS
  6. ;;;
  7. ;;;  This program is free software; you can redistribute it and/or modify
  8. ;;;  it under the terms of the GNU General Public License as published by
  9. ;;;  the Free Software Foundation; either version 2 of the License, or
  10. ;;;  (at your option) any later version.
  11. ;;;
  12. ;;;  This program is distributed in the hope that it will be useful,
  13. ;;;  but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;;;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. ;;;  GNU General Public License for more details.
  16. ;;;
  17. ;;;  You should have received a copy of the GNU General Public License
  18. ;;;  along with this program; if not, write to the Free Software
  19. ;;;  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. ;;;
  21. ;;;
  22. ;;;  Author:   Jochen Wiedmann
  23. ;;;      Am Eisteich 9
  24. ;;;      72555 Metzingen
  25. ;;;      Germany
  26. ;;;
  27. ;;;      Phone: (0049) +7123 / 14881
  28. ;;;      Internet: jochen.wiedmann@zdv.uni-tuebingen.de
  29. ;;;
  30. ;;;
  31. ;;;
  32. ;;;  History:   07-Apr-95       Initial version
  33. ;;;
  34. ;;;             14-Apr-95       Added CHECK, OFF and SET options to
  35. ;;;                             GNU:s/User-Startup
  36. ;;;                             CopyEnvironment procedure does no
  37. ;;;                             longer depend on the existence of
  38. ;;;                             GNU:envarc.
  39. ;;;
  40. ;;;             20-Apr-95       Assign GNUINCLUDE: now optional.
  41. ;;;                             User may switch between modifying
  42. ;;;                             specs file and using C_INCLUDE_PATH.
  43. ;;;
  44. ;;;             13-May-95       Fixed bug in the specs file modification.
  45. ;;;                             Added existence checks to Rename020Binaries.
  46. ;;;
  47. ;;;             20-May-95       Removed GCCSTACK variable (No longer
  48. ;;;                             needed by gcc 2.7.0)
  49. ;;;
  50. ;;;             26-May-95       Fixed typo
  51. ;;;
  52. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  53.  
  54.  
  55. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  56. ;;;
  57. ;;;  Variable settings
  58. ;;;
  59. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  60. (set installName "gcc")
  61. (set installVersion "2.7.0")
  62. (set installVersionShort "gcc270")
  63. (set minOsVersion 37)
  64.  
  65.  
  66. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  67. ;;;
  68. ;;;  SelectInstallDir procedure
  69. ;;;
  70. ;;;  Allows the user to select an installation directory (full path),
  71. ;;;  which will be stored in the installDir variable.
  72. ;;;
  73. ;;;  Uses:  installDir      old installation directory path
  74. ;;;
  75. ;;;  Sets:  installDir      installation directory path
  76. ;;;
  77. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  78. (set askedInstallDir 0)
  79. (set configSubDir 0)
  80. (procedure SelectInstallDir
  81.  
  82.     (if (NOT askedInstallDir)
  83.     (   (if configSubDir
  84.     (   (set installDir (expandpath (askdir
  85.         (prompt "Please select the directory to configure. ")
  86.         (help "GNU C is installed in one directory, Work:GNU "
  87.               "or something similar. Please select this "
  88.               "directory, so that I can reconfigure it.\n\n"
  89.         )
  90.         (default installDir)
  91.         (newpath)
  92.         )))
  93.  
  94.         (set installDirParent (pathonly installDir))
  95.     )
  96.     (   (set installDirParent (expandpath (askdir
  97.         (prompt "Please select the installation directory. "
  98.             "A drawer GNU will be created."
  99.         )
  100.         (help "GNU C is installed in a directory called `GNU:'. "
  101.               "For example, binaries go into `GNU:bin', link "
  102.               "libraries in `GNU:lib' and so on.\n\n"
  103.               "A typical place for GNU: is something like "
  104.               "`Work:GNU' or something similar. In this "
  105.               "example you should select the directory "
  106.               "`Work:'.\n\n"
  107.               @askdir-help
  108.         )
  109.         (default (pathonly installDir))
  110.         (newpath)
  111.         )))
  112.  
  113.         (set installDir (tackon installDirParent "GNU"))
  114.  
  115.         (message "Installing GNU C in " installDir ".\n\n"
  116.              "Binaries will be in " (tackon installDir "bin")
  117.              ", link libraries in " (tackon installDir "lib")
  118.              ", header files in " (tackon installDir "include")
  119.              "."
  120.         )
  121.     ))
  122.     (set @default-dest installDir)
  123.     (CompleteStep)
  124.  
  125.     (set askedInstallDir 1)
  126.     ))
  127. )
  128.  
  129.  
  130. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  131. ;;;
  132. ;;;  SelectVersion procedure
  133. ;;;
  134. ;;;  Allows the user to select a version to install.
  135. ;;;
  136. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  137. (set askedInstallVersion 0)
  138. (procedure SelectVersion
  139.  
  140.     (if (NOT askedInstallVersion)
  141.     (   (set installVersion (askstring
  142.         (prompt "Enter the version of GNU C to install.")
  143.         (help "Certain files and directories contain the version "
  144.           "of GNU C in the path, thus I need to know them. "
  145.           "Please enter the GNU C version in the form "
  146.           installVersion ".\n\n"
  147.           @askstring-help
  148.         )
  149.         (default installVersion)
  150.     ))
  151.  
  152.     (set installVersionShort (cat
  153.         (substr installVersion 0 1)
  154.         (substr installVersion 2 1)
  155.         (substr installVersion 4 1)
  156.     ))
  157.  
  158.     (set askedInstallVersion 1)
  159.     ))
  160. )
  161.  
  162.  
  163. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  164. ;;;
  165. ;;;  SelectDeinstallDir procedure
  166. ;;;
  167. ;;;  Allows the user to select a directory to be deinstalled.
  168. ;;;
  169. ;;;  Uses: oldInstallDir    directory of recent GNU C installation
  170. ;;;
  171. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  172. (procedure SelectDeinstallDir
  173.  
  174.     (set deinstallDir (askdir
  175.     (prompt "Select the directory where to deinstall GNU C.")
  176.     (help "If your GNU C version is installed in Work:GNU, for "
  177.           "example, select Work:GNU, so that I can remove it.\n\n"
  178.           @askdir-help
  179.     )
  180.     (default oldInstallDir)
  181.     ))
  182.     (CompleteStep)
  183. )
  184.  
  185.  
  186. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  187. ;;;
  188. ;;;  CheckObsoleteDir procedure
  189. ;;;
  190. ;;;  Asks the user if he wants an "obsolete" directory and creates it,
  191. ;;;  if this is the case. The name will be stored in installObsoleteDir
  192. ;;;  in that case, otherwise this variable will receive the value "".
  193. ;;;
  194. ;;;  Uses: installDir   name of installation directory
  195. ;;;
  196. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  197. (set installObsoleteDirChecked 0)
  198. (procedure CheckObsoleteDir
  199.  
  200.     (if (NOT installObsoleteDirChecked)
  201.     (   (set installObsoleteDir (tackon installDir "obsolete"))
  202.     (if (<> (exists installObsoleteDir) 2)
  203.     (   (makedir installObsoleteDir
  204.         (prompt "Creating a directory " installObsoleteDir " to keep "
  205.             "old prefs files and icons."
  206.         )
  207.         (help "Old user-editabe files may be prevented from "
  208.               "deletion by copying them to " installObsoleteDir
  209.               ". You may skip this part, if you don't want this.\n\n"
  210.               @makedir-help
  211.         )
  212.         (confirm 2)
  213.         (infos)
  214.         )
  215.         (if (<> (exists installObsoleteDir) 2)
  216.         (   (set installObsoleteDir "")
  217.         ))
  218.     ))
  219.     (set installObsoleteDirChecked 1)
  220.     ))
  221. )
  222.  
  223.  
  224. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  225. ;;;
  226. ;;;  CheckObsoleteFile procedure
  227. ;;;
  228. ;;;  Uses: checkObsoleteFileName    name of file to be copyied into the
  229. ;;;                                 obsolete directory (relative to
  230. ;;;                                 installDir)
  231. ;;;        installObsoleteDir       name of the "obsolete" directory
  232. ;;;        installDir               name of the installation directory
  233. ;;;
  234. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  235. (procedure CheckObsoleteFile
  236.  
  237.     (if (exists checkObsoleteFileName)
  238.     (   (CheckObsoleteDir)
  239.  
  240.     (if installObsoleteDir
  241.     (   (copyfiles
  242.         (prompt ("Preserving old file %s ..." checkObsoleteFileName))
  243.         (help "The old file " checkObsoleteName " may be preserved "
  244.               "by copying it to " installObsoleteDir ". You may skip "
  245.               "this part, if you don't want this.\n\n"
  246.               @copyfiles-help
  247.         )
  248.         (source checkObsoleteFileName)
  249.         (dest installObsoleteDir)
  250.         (infos)
  251.         (confirm 2)
  252.         (optional "oknodelete" "force" "askuser")
  253.         )
  254.     ))
  255.     ))
  256. )
  257.  
  258.  
  259. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  260. ;;;
  261. ;;;  CheckOsVersion procedure
  262. ;;;
  263. ;;;  Aborts, if OS version is lower than the variable minOsVersion.
  264. ;;;  Sets osVersion variable.
  265. ;;;
  266. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  267. (procedure CheckOsVersion
  268.     (set osVersion (/ (getversion "exec.library" (resident)) 65536))
  269.     (if (< osVersion minOsVersion)
  270.     (   (abort "Sorry, " installName
  271.            " needs Kickstart/Workbench 2.04 or higher.")
  272.     ))
  273. )
  274.  
  275.  
  276. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  277. ;;;
  278. ;;;  ShowCopyrightMessage procedure
  279. ;;;
  280. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  281. (procedure ShowCopyrightMessage
  282.     (message "GNU C:    The GNU Project C and C++ Compiler\n\n"
  283.     "V" installVersion "     © 1995 Free Software Foundation  \n\n"
  284.     "This program is FREE SOFTWARE; you can redistribute it and/or "
  285.     "modify it under the terms of the GNU General Public License as "
  286.     "published by the Free Software Foundation; either version 2 "
  287.     "or any later version.\n\n"
  288.     "This program is distributed in the hope that it will be useful, "
  289.     "but WITHOUT ANY WARRANTY! See the GNU General Public License "
  290.     "(in the file COPYING) for details."
  291.     )
  292. )
  293.  
  294.  
  295. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  296. ;;;
  297. ;;;  CheckGNUDir procedure
  298. ;;;
  299. ;;;  Checks, if GNU: or GCC: assign exists; stores value in
  300. ;;;  installDir sets boolean variable oldInstallationSeen.
  301. ;;;
  302. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  303. (procedure CheckGNUDir
  304.  
  305.     (set installDir (getassign "GNU" "va"))
  306.     (if (= installDir "")
  307.     (   (set installDir (getassign "GCC" "va"))
  308.     ))
  309.  
  310.     (if (<> installDir "")
  311.     (   (set installDir (expandpath installDir))
  312.     (set oldInstallationSeen 1)
  313.     (set oldInstallDir installDir)
  314.     (transcript "Existing GNU C installation in " installDir
  315.             " detected.")
  316.     )
  317.     (   (set installDir "SYS:GNU")
  318.     (set oldInstallationSeen 0)
  319.     (transcript "Performing initial GNU C installation.")
  320.     ))
  321.     (set @default-dest installDir)
  322. )
  323.  
  324.  
  325. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  326. ;;;
  327. ;;;  DeinstallGNU procedure
  328. ;;;
  329. ;;;  Deletes GNU:lib/gcc-lib or GNU: (if the GNU: path was changed by
  330. ;;;  the user)
  331. ;;;
  332. ;;;  Uses: deinstallDir     Directory where to deinstall GNU C.
  333. ;;;
  334. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  335. (procedure DeinstallGNU
  336.  
  337.     (set deinstallKind (askchoice
  338.     (prompt "Which kind of deinstallation do you want?")
  339.     (help "Selecting \"Complete deinstallation\" means removing "
  340.           "the complete directory " deinstallDir ". This is "
  341.           "usually selected, if you want to remove GNU C or "
  342.           "want to install a new version in another directory.\n\n"
  343.           "If you just want to replace the existing version with "
  344.           "a new one in the same directory, it should be "
  345.           "sufficient to select \"Partial deinstallation\": This "
  346.           "will only remove " (tackon deinstallDir "lib/gcc-lib")
  347.           ", as other files will be overwritten when installing "
  348.           "the new version.\n\n"
  349.           @askchoice-help
  350.     )
  351.     (choices "Complete deinstallation"
  352.          "Partial deinstallation"
  353.     )
  354.     (default 0)
  355.     ))
  356.     (if (patmatch deinstallDir oldInstallDir)
  357.     (   (startup "GNU stuff"
  358.         (prompt "Removing GNU C from s:User-Startup.")
  359.         (help "Your version of GNU C in " deinstallDir
  360.           "will be no longer usable. If there are any lines in "
  361.           "your S:User-Startup concerning GNU C, they should "
  362.           "probably be removed.\n\n"
  363.           @startup-help
  364.         )
  365.     )
  366.     ))
  367.     (CompleteStep)
  368.  
  369.     (select deinstallKind
  370.     (   (set deleteFileName deinstallDir)
  371.     (DeleteFile)
  372.     (if (patmatch deinstallDir oldInstallDir)
  373.     (   (message "I was not able to remove the directory "
  374.              deinstallDir " and some of its subdirectories, "
  375.              "as there are still assigns pointing to them.\n\n"
  376.              "You should remove them manually later.\n"
  377.         )
  378.     ))
  379.     )
  380.     (   (set deleteFileName (tackon deinstallDir "lib/gcc-lib"))
  381.     (DeleteFile)
  382.     ))
  383.     (CompleteStep)
  384. )
  385.  
  386.  
  387. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  388. ;;;
  389. ;;;  DeleteFile procedure
  390. ;;;
  391. ;;;  Deletes a file
  392. ;;;
  393. ;;;  Uses: deleteFileName   file to delete
  394. ;;;
  395. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  396. (procedure DeleteFile
  397.  
  398.     (select (exists deleteFileName)
  399.     (   (set deleteFileName deleteFileName)
  400.     )
  401.     (   (delete deleteFileName
  402.         (prompt "Deleting " deleteFileName "...")
  403.         (optional "force" "askuser")
  404.     )
  405.     )
  406.     (   (working "Deleting directory " deleteFileName)
  407.     (run (cat "C:Delete \"" deleteFileName "\" ALL QUIET"))
  408.     ))
  409. )
  410.  
  411.  
  412. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  413. ;;;
  414. ;;;  SelectLHAProgram procedure
  415. ;;;
  416. ;;;  Lets the user select the LHA binary; sets the variable lhaProgram.
  417. ;;;
  418. ;;;  Sets: lhaProgram   path of LhA binary
  419. ;;;
  420. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  421. (procedure SelectLHAProgram
  422.  
  423.     (set l 1)
  424.     (while l
  425.     (   (set lhaProgram (askfile
  426.         (prompt "Please select your LhA program.")
  427.         (help "Unfortunately the Installer program ignores "
  428.           "your path settings. Thus I need to know the "
  429.           "complete path of your LhA program.\n\n"
  430.           @askfile-help
  431.         )
  432.         (default "LhA")
  433.     ))
  434.     (if (exists lhaProgram)
  435.     (   (set l 0)
  436.     ))
  437.     ))
  438.     (CompleteStep)
  439. )
  440.  
  441.  
  442. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  443. ;;;
  444. ;;;  SelectPackages procedure
  445. ;;;
  446. ;;;  Allows the user to select the archives that should be unarchived.
  447. ;;;  Result is stored in the gnuPackagesChoice variable.
  448. ;;;
  449. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  450. (procedure SelectPackages
  451.  
  452.     (set gnuPackagesChoice (askoptions
  453.     (prompt "Which parts of gcc should be installed?")
  454.     (choices "Base distribution"
  455.          "Includes & Libraries"
  456.          "C"
  457.          "C++"
  458.          "Objective-C"
  459.          "Additional Utilities"
  460.          "On-line Documentation"
  461.          "Utilities On-line Documentation"
  462.          "Source Diffs"
  463.          "Documentation sources")
  464.     (default 71)
  465.     (help "gcc is distributed in different LhA archives. "
  466.           "I will unarchive those parts to " installDir
  467.           " that you select.\n\n"
  468.           "A minimal installation requires base distribution, "
  469.           "Includes & Libraries and the C distribution. This will take "
  470.           "about 7.5 MB of harddisk space. However, I recommend at least "
  471.           "adding the on-line documentation, so you get a minimum of "
  472.           "10 MB.\n\n"
  473.           @askoptions-help
  474.     )
  475.     ))
  476.     (CompleteStep)
  477. )
  478.  
  479.  
  480. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  481. ;;;
  482. ;;;  Ask020Binaries procedure
  483. ;;;
  484. ;;;  Asks the user, if he wants the 68020 binaries. Result stored in
  485. ;;;  install020 variable.
  486. ;;;
  487. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  488. (set asked020Binaries 0)
  489. (procedure Ask020Binaries
  490.  
  491.     (if (NOT asked020Binaries)
  492.     (   (set install020 "")
  493.     (if (NOT (OR (= (database "cpu") "68000")
  494.              (= (database "cpu") "68010")
  495.         ))
  496.     (   (if (askbool
  497.             (prompt "Do you like to have the 68020 binaries "
  498.                 "installed?\n\n"
  499.                 "Of course you need to have the 68020 binaries "
  500.                 "(packages gcc263-c-020.lha, gcc263-c++-020.lha "
  501.                 "and gcc263-objc020.lha, respectively) "
  502.                 "available.\n\n"
  503.             )
  504.             (help "The GNU C distribution offers two different "
  505.               "binary versions. If your machine's CPU is a "
  506.               "68020 or above, then you should install the "
  507.               "68020 binaries and select \"Yes\". This won't "
  508.               "affect the binaries created by you. It only "
  509.               "increases the compilers speed.\n\n"
  510.               "Otherwise you should select \"No\".\n\n"
  511.               @askbool-help
  512.             )
  513.             (default 1)
  514.         )
  515.         (   (set install020 "-020")
  516.         ))
  517.     ))
  518.     (CompleteStep)
  519.  
  520.     (set asked020Binaries 1)
  521.     ))
  522. )
  523.  
  524.  
  525. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  526. ;;;
  527. ;;;  UnpackArchive procedure
  528. ;;;
  529. ;;;  Unpacks one LhA file.
  530. ;;;
  531. ;;;  Uses: installArchiveName   name of archive file
  532. ;;;        lhaCommand           command to execute for dearchiving
  533. ;;;
  534. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  535. (set defaultArchivePath "")
  536. (procedure UnPackArchive
  537.  
  538.  
  539.     (set l 1)
  540.     (while l
  541.     (   (set installArchive (askfile
  542.         (prompt "Please select the archive file "
  543.              installArchiveName " for unpacking."
  544.         )
  545.         (help "Please select the archive file " installArchiveName ". "
  546.           "I will unpack this archive to " installDir ".\n\n"
  547.           @askfile-help
  548.         )
  549.         (default (tackon defaultArchivePath installArchiveName))
  550.     ))
  551.     (set defaultArchivePath (pathonly installArchive))
  552.     (if (exists installArchive)
  553.     (   (set l 0)
  554.         (if (run (lhaCommand installArchive)
  555.             (prompt ("\n\nUnpacking %s ..." installArchive))
  556.         )
  557.         (   (abort "\n\n" (lhaCommand installArchive)
  558.                "\n\nshowed an error."
  559.         )
  560.         ))
  561.     )
  562.     (   (message "File " installArchive " does not exist.")
  563.         (set installArchive "")
  564.     ))
  565.     ))
  566. )
  567.  
  568.  
  569. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  570. ;;;
  571. ;;;  CopyEnvironment procedure
  572. ;;;
  573. ;;;  Creates environment variables
  574. ;;;
  575. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  576. (procedure CopyEnvironment
  577.  
  578.     (SelectOSHeadersDir)
  579.  
  580.     (set varsToCreatePrompt "Installing environment variables in \"ENVARC:\"")
  581.     (set varsToCreateHelp
  582.     (cat "Some environment variables are required or encouraged.\n\n"
  583.          "GCCPRIORITY is the priority of gcc's child processes.\n"
  584.          "LESSCHARSET, PAGER and TERM usually aren't needed, "
  585.          "except, if you are using \"less\" or similar programs.\n\n"
  586.     ))
  587.  
  588.     (if (AND (<> osHeadersDir "")
  589.          (= osHeadersInstallStyle 1))
  590.  
  591.     (   (if useGNUINCLUDE
  592.     (   (set includePath "/GNUINCLUDE")
  593.     )
  594.     (   (set includePath osHeadersDir)
  595.     ))
  596.  
  597.     (set varsToCreate (askoptions
  598.         (prompt varsToCreatePrompt)
  599.         (help varsToCreateHelp
  600.           "C_INCLUDE_PATH, CPLUS_INCLUDE_PATH, OBJC_INCLUDE_PATH "
  601.           "and OBJCPLUS_INCLUDEPATH tell gcc, where to find the "
  602.           "OS headers.\n\n"
  603.           @askoptions-help
  604.         )
  605.         (choices "GCCPRIORITY"
  606.              "GCCSTACK"
  607.              "LESSCHARSET"
  608.              "PAGER"
  609.              "TERM"
  610.              "C_INCLUDE_PATH"
  611.              "CPLUS_INCLUDE_PATH"
  612.              "OBJC_INCLUDE_PATH"
  613.              "OBJCPLUS_INCLUDE_PATH"
  614.         )
  615.         (default 511)
  616.     ))
  617.     )
  618.     (   (set varsToCreate (askoptions
  619.         (prompt varsToCreatePrompt)
  620.         (help varsToCreateHelp @askoptions-help)
  621.         (choices "GCCPRIORITY"
  622.              "GCCSTACK"
  623.              "LESSCHARSET"
  624.              "PAGER"
  625.              "TERM"
  626.         )
  627.         (default 31)
  628.     ))
  629.     ))
  630.  
  631.  
  632.     (set n 0)
  633.     (set bit 1)
  634.     (while (set word (select n "GCCPRIORITY"            "-1"
  635.                    "GCCSTACK"               "350000"
  636.                    "LESSCHARSET"            "latin"
  637.                    "PAGER"                  "/usr/bin/more"
  638.                    "TERM"                   "amiga"
  639.                    "C_INCLUDE_PATH"         includePath
  640.                    "CPLUS_INCLUDE_PATH"     includePath
  641.                    "OBJC_INCLUDE_PATH"      includePath
  642.                    "OBJCPLUS_INCLUDE_PATH"  includePath
  643.                    ""
  644.        ))
  645.     (   (if (BITAND n 1)
  646.     (   (if (BITAND bit varsToCreate)
  647.         (   (set checkObsoleteFileName (tackon "ENVARC:" varName))
  648.         (CheckObsoleteFile)
  649.         (textfile
  650.             (prompt "Creating environment variable " varName)
  651.             (help @textfile-help)
  652.             (dest (tackon "ENVARC:" varName))
  653.             (append word)
  654.         )
  655.         ))
  656.         (set bit (shiftleft bit 1))
  657.     )
  658.     (   (set varName word)
  659.     ))
  660.     (set n (+ n 1))
  661.     ))
  662.  
  663. ;   (if (exists "ENVARC:GCCSTACK")
  664. ;   (   (if (askbool
  665. ;        (prompt "The environment variable GCCSTACK is no longer "
  666. ;            "needed as of gcc 2.7.0.\n\n"
  667. ;            "Do you want to remove it?\n"
  668. ;        )
  669. ;        (help "Recent versions of gcc (2.6.0-2.6.3) needed an "
  670. ;              "environment variable GCCSTACK to ensure sufficient "
  671. ;              "stack. This variable is no longer needed, as gcc "
  672. ;              "extends its stack dynamically now.\n\n"
  673. ;              "Select \"Yes\", if you want to remove this "
  674. ;              "obsolete variable or \"No\", if you want to "
  675. ;              "keep it for recent versions."
  676. ;        )
  677. ;        (default 1)
  678. ;        )
  679. ;    (   (set deleteFileName "ENVARC:GCCSTACK")
  680. ;        (DeleteFile)
  681. ;    ))
  682. ;   ))
  683.  
  684.     (CompleteStep)
  685. )
  686.  
  687.  
  688. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  689. ;;;
  690. ;;;  ModifyUserStartup procedure
  691. ;;;
  692. ;;;  Modifies s:User-Startup and creates GNU:s/User-Startup
  693. ;;;
  694. ;;;  Uses: installDir   installation directory
  695. ;;;        osHeadersDir path of OS headers
  696. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  697. (procedure ModifyUserStartup
  698.  
  699.     (SelectOSHeadersDir)
  700.  
  701.     (startup "GNU stuff"
  702.     (command "Assign GNU: " installDir "\n")
  703.     (command "Execute GNU:s/User-Startup\n")
  704.     (prompt "The following lines should be added to your s:User-Startup:\n\n"
  705.         "Assign GNU: " installDir "\n"
  706.         "Execute GNU:s/User-Startup\n\n"
  707.         "Shall I do this now?"
  708.     )
  709.     (help "gcc needs a special environment, some assigns for example. "
  710.           "The easiest way to get this environment is to meodify your "
  711.           "User-Startup file, so that it is created automatically when "
  712.           "your machine boots.\n\n"
  713.           @startup-help
  714.     )
  715.     )
  716.  
  717.     (if (AND (<> osHeadersDir "")
  718.          (= osHeadersInstallStyle 0))
  719.     (   (SelectVersion)
  720.     (Ask020Binaries)
  721.     (if (<> install020 "")
  722.     (   (set specsFile (tackon installDir
  723.                    (cat "lib/gcc-lib/mc68020-cbm-amigados/"
  724.                     installVersion "/specs"))
  725.         )
  726.     )
  727.     (   (set specsFile (tackon installDir
  728.                    (cat "lib/gcc-lib/mc68000-cbm-amigados/"
  729.                     installVersion "/specs"))
  730.         )
  731.     ))
  732.  
  733.     (if (AND (exists "C:Edit")
  734.          (exists specsFile))
  735.     (   (if useGNUINCLUDE
  736.         (   (set specsString "-IGNUINCLUDE:")
  737.         )
  738.         (   (set specsString (cat "-I" osHeadersDir))
  739.         ))
  740.  
  741.         (set checkObsoleteFileName specsFile)
  742.         (CheckObsoleteFile)
  743.         (textfile
  744.         (prompt "Creating batch file for C:Edit.")
  745.         (help "A batchfile with commands for C:Edit must be "
  746.               "created."
  747.               @textfile-help
  748.         )
  749.         (dest "t:specsFileEdit")
  750.         (append "F B/*cpp:/\n"
  751.             "N\n"
  752.             "DTB /%{m68881/\n"
  753.             "B,%{m68881,%{!nostdinc:" specsString "} ,\n"
  754.             "Q\n"
  755.         )
  756.         )
  757.         (run (cat "C:Edit " specsFile " WITH t:specsFileEdit OPT W4096"))
  758.         (set deleteFileName "t:specsFileEdit")
  759.         (DeleteFile)
  760.     )
  761.     (   (message
  762.         "C:Edit or specs file " specsFile
  763.         "not found. You must edit the specs file "
  764.         "manually and add \"" specsString "\" to "
  765.         "the cpp entry. The line should look as follows:\n\n"
  766.         "    *cpp:\n"
  767.         "    %{!nostdinc:" specsString " }%{m68881 ...\n\n"
  768.         "Otherwise you need to add \"" specsString "\" to your "
  769.         "command line each time you are using Commodore "
  770.         "headers."
  771.         )
  772.     ))
  773.     )
  774.     (   (set osHeadersString "")
  775.     ))
  776.  
  777.     (if (<> (exists (tackon installDir "s")) 2)
  778.     (   (makedir (tackon installDir "s")
  779.         (prompt "Creating GNU:s directory.")
  780.         (help "A directory GNU:s will be created which contains "
  781.           "the files that are executed at startup time."
  782.           @makedir-help
  783.         )
  784.     )
  785.     ))
  786.  
  787.     (set checkObsoleteFileName (tackon installDir "s/User-Startup"))
  788.     (CheckObsoleteFile)
  789.     (if useGNUINCLUDE
  790.     (   (set installGNUINCLUDE
  791.         (cat "            Assign GNUINCLUDE: \"" osHeadersDir "\"\n")
  792.     )
  793.     (set deinstallGNUINCLUDE
  794.         (cat "        Assign GNUINCLUDE: REMOVE >nil:\n")
  795.     )
  796.     )
  797.     (   (set installGNUINCLUDE "")
  798.     (set deinstallGNUINCLUDE "")
  799.     ))
  800.  
  801.     (textfile
  802.     (prompt "Creating the GNU startup file GNU:s/user-startup.")
  803.     (help "The file GNU:s/user-startup must be executed before "
  804.           "using gcc, usually from s:User-Startup."
  805.     )
  806.     (dest (tackon installDir "s/User-Startup"))
  807.     (append ".key ON/S,OFF/S,SET/S,CHECK/S\n"
  808.         ".bra {\n"
  809.         ".ket }\n"
  810.         "\n"
  811.         ";  GNU User-Startup\n"
  812.         ";\n"
  813.         ";      User-Startup ON     for installing GNU assigns. (default)\n"
  814.         ";      User-Startup OFF    for removing GNU assigns.\n"
  815.         ";      User-Startup CHECK  for checking, if assigns exist.\n"
  816.         ";      User-Startup SET    for setting paths only.\n"
  817.         "\n"
  818.         "IF \"{OFF}\" EQ \"\"\n"
  819.         "    IF \"{CHECK}\" EQ \"\"\n"
  820.         "        IF \"{SET}\" EQ \"\"\n"
  821.         "            Assign GNU: EXISTS >nil:\n"
  822.         "            IF WARN\n"
  823.         "                Assign GNU: \"" installDir "\"\n"
  824.         "            ENDIF\n"
  825.         "            Assign BIN:        GNU:bin\n"
  826.         "            Assign ETC:        GNU:etc\n"
  827.         "            Assign DEV:        GNU:dev\n"
  828.         "            Assign TMP:        t:\n"
  829.         "            Assign LIBS:       GNU:Libs ADD\n"
  830.         "            Assign LOCAL:      GNU:\n"
  831.         installGNUINCLUDE
  832.         "            Assign L:          GNU:ixpipe ADD\n"
  833.         "        ENDIF\n"
  834.         "        Set ESHELL \"GNU:bin/sh\"\n"
  835.         "        Path GNU:bin add\n"
  836.         "    ELSE\n"
  837.         "        Assign GNU: EXISTS >nil:\n"
  838.         "        IF WARN\n"
  839.         "            Echo \"Asign GNU: doesn't exist.\"\n"
  840.         "            QUIT 5\n"
  841.         "        ELSE\n"
  842.         "            Echo \"Assign GNU: exists.\"\n"
  843.         "        ENDIF\n"
  844.         "    ENDIF\n"
  845.         "ELSE\n"
  846.         "    Assign GNU: EXISTS >nil:\n"
  847.         "    IF NOT WARN\n"
  848.         "        Path GNU: REMOVE >nil:\n"
  849.         "        UnSet ESHELL\n"
  850.         "        Assign L: GNU:ixpipe REMOVE >nil:\n"
  851.         deinstallGNUINCLUDE
  852.         "        Assign LOCAL: REMOVE >nil:\n"
  853.         "        Assign LIBS: GNU:Libs REMOVE\n"
  854.         "        Assign TMP: REMOVE\n"
  855.         "        Assign DEV: REMOVE\n"
  856.         "        Assign ETC: REMOVE\n"
  857.         "        Assign BIN: REMOVE\n"
  858.         "        Assign GNU: REMOVE\n"
  859.         "    ENDIF\n"
  860.         "ENDIF\n"
  861.     )
  862.     )
  863.     (protect (tackon installDir "s/User-Startup") "+s")
  864.  
  865.     (CompleteStep)
  866. )
  867.  
  868.  
  869. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  870. ;;;
  871. ;;;  CreateLink procedure
  872. ;;;
  873. ;;;  Creates one link
  874. ;;;
  875. ;;;  Uses: useLinks         1, if "C:MakeLink" should be used, 0 for copy
  876. ;;;        linkDestFile     file to be created (absolute path)
  877. ;;;        linkSourceFile   file to be copied (absolute path)
  878. ;;;
  879. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  880. (procedure CreateLink
  881.  
  882.     (if (exists linkSourceFile)
  883.     (   (if (exists linkDestFile)
  884.     (   (set deleteFileName linkDestFile)
  885.         (DeleteFile)
  886.     ))
  887.     (if useLinks
  888.     (   (run (cat "C:MakeLink \"" linkDestFile "\" \"" linkSourceFile))
  889.     )
  890.     (   (copyfiles
  891.         (prompt "Faking link from " linkSourceFile " to "
  892.             linkDestFile "."
  893.         )
  894.         (source linkSourceFile)
  895.         (dest (pathonly linkDestFile))
  896.         (newname (fileonly linkDestFile))
  897.         (optional "askuser" "force")
  898.         )
  899.     ))
  900.     ))
  901. )
  902.  
  903.  
  904. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  905. ;;;
  906. ;;;  CreateNeededLinks procedure
  907. ;;;
  908. ;;;  Creates needed links.
  909. ;;;
  910. ;;;  Uses: installDir
  911. ;;;
  912. ;;;  Sets: useLinks
  913. ;;;
  914. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  915. (procedure CreateNeededLinks
  916.  
  917.     (set useLinks (askchoice
  918.     (prompt "\n\nSome files may be installed either as links "
  919.         "or copied. What do you prefer?"
  920.     )
  921.     (help "\n\nAmigaDOS is still having problems with links. "
  922.           "Thus you might prefer to copy files."
  923.           "\n\nOn the other hand links save disk space. "
  924.           "(Not very much.)"
  925.           @askbool-help
  926.     )
  927.     (choices "Copy them anyway"
  928.          "Use Links"
  929.     )
  930.     (default 0)
  931.     ))
  932.  
  933.     (set n 0)
  934.     (set left 0)
  935.     (while (set file (select n "bin/gzip"           "bin/gunzip"
  936.                    "bin/gzip"           "bin/zcat"
  937.                    "bin/zdiff"          "bin/zcmp"
  938.                    "bin/grep"           "bin/fgrep"
  939.                    "bin/grep"           "bin/egrep"
  940.                    "bin/dir"            "bin/d"
  941.                    "bin/dir"            "bin/v"
  942.                    "bin/dir"            "bin/vdir"
  943.                    "bin/flex"           "bin/flex++"
  944.                    "bin/install"        "bin/ginstall"
  945.                    "bin/sh"             "bin/ksh"
  946.                    "bin/awk"            "bin/gawk"
  947.                    "bin/test"           "bin/["
  948.                    "man/man1/gzip.1"    "man/man1/gunzip.1"
  949.                    "man/man1/gzip.1"    "man/man1/zcat.1"
  950.                    "man/man1/zdiff.1"   "man/man1/zcmp.1"
  951.                    ""
  952.        ))
  953.     (   (if left
  954.     (   (set linkDestFile (tackon installDir file))
  955.         (CreateLink)
  956.     )
  957.     (   (set linkSourceFile (tackon installDir file))
  958.     ))
  959.     (set left (NOT left))
  960.     (set n (+ n 1))
  961.     ))
  962.  
  963.     (CompleteStep)
  964. )
  965.  
  966.  
  967. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  968. ;;;
  969. ;;;  Rename020Binaries procedure
  970. ;;;
  971. ;;;  Renames gcc-020, g++-020, ... to gcc, g++, ..., respectively
  972. ;;;
  973. ;;;  Uses: install020   set, if 68020 binaries to be installed
  974. ;;;
  975. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  976. (procedure Rename020Binaries
  977.  
  978.     (Ask020Binaries)
  979.  
  980.     (if (<> install020 "")
  981.     (   (if (askbool
  982.         (prompt "\n\nDo you want me to rename the binaries "
  983.             "gcc-020, g++-020, ... to gcc, g++, ..., "
  984.             "respectively?"
  985.         )
  986.         (help "Some users have both 68000 and 68020 binaries "
  987.               "available. This requires, that certain binaries "
  988.               "like gcc, g++ ... have the ending \"-020\" "
  989.               "appended to their name.\n\n"
  990.               "Most others won't prefer to use the names gcc, "
  991.               "g++, ..., however. If you do, select \"Yes\", "
  992.               "and I will rename them, otherwise select "
  993.               "\"No\".\n\n "
  994.               @askbool-help
  995.         )
  996.         (default 1)
  997.         )
  998.     (   (set n 0)
  999.         (while (set file (select n "bin/gcc"
  1000.                        "bin/c++"
  1001.                        "bin/g++"
  1002.                        "bin/gccv"
  1003.                        "bin/protoize"
  1004.                        "bin/unprotoize"
  1005.                        ""
  1006.            ))
  1007.         (   (set newFileName (tackon installDir file))
  1008.         (set oldFileName (cat newFileName "-020"))
  1009.         (if (exists oldFileName)
  1010.         (   (set deleteFileName newFileName)
  1011.             (DeleteFile)
  1012.             (rename oldFileName newFileName)
  1013.         ))
  1014.         (set n (+ n 1))
  1015.         ))
  1016.     ))
  1017.     ))
  1018.     (CompleteStep)
  1019. )
  1020.  
  1021.  
  1022. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1023. ;;;
  1024. ;;;  SelectOSHeadersDir procedure
  1025. ;;;
  1026. ;;;  Allows the user to select a directory with OS header files.
  1027. ;;;
  1028. ;;;  Sets: osHeadersDir     path to the directory with OS headers.
  1029. ;;;
  1030. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1031. (set osHeadersDirSelected 0)
  1032. (procedure SelectOSHeadersDir
  1033.  
  1034.     (if (NOT osHeadersDirSelected)
  1035.     (   (set osHeadersDir "")
  1036.     (set osHeadersDirDefault (getassign "GNUINCLUDE" "a"))
  1037.     (set useGNUINCLUDE 0)
  1038.     (set done 0)
  1039.     (while (NOT done)
  1040.     (   (if (askbool
  1041.         (prompt "Do you have the Commodore OS headers installed?")
  1042.         (help "Using the Commodore OS headers may be simplified "
  1043.               "by creating an assign \"GNUINCLUDE:\". Select "
  1044.               "\"Yes\", if you want me to create this assign, "
  1045.               "\"No\" otherwise.\n\n"
  1046.               @askbool-help
  1047.         ))
  1048.         (   (set osHeadersDir (askfile
  1049.             (prompt "Please select the directory with the "
  1050.                 "Commodore OS headers."
  1051.             )
  1052.             (help "Using the Commodore OS headers may be simplified "
  1053.               "by creating an assign \"GNUINCLUDE:\", which "
  1054.               "will lead to the directory with the Commodore "
  1055.               "OS headers. Please select this directory, so that "
  1056.               "I can create this assign.\n\n"
  1057.               @askfile-help
  1058.             )
  1059.             (default osHeadersDirDefault)
  1060.         ))
  1061.         (if (exists (tackon osHeadersDir "exec/types.h"))
  1062.         (   (set done 1)
  1063.         )
  1064.         (   (message "The directory " osHeadersDir " doesn't "
  1065.                  "contain the Commodore OS headers: Cannot "
  1066.                  "find "
  1067.                  (tackon osHeadersDir "exec/types.h")
  1068.             )
  1069.             (set osHeadersDirDefault osHeadersDir)
  1070.             (set osHeadersDir "")
  1071.         ))
  1072.         )
  1073.         (   (message "You won't be able to write real Amiga applications "
  1074.              "without the Commodore OS headers.\n\n"
  1075.              "You can get them, for example, on the Fish CD's or "
  1076.              "buy them (including the Commodore AutoDocs). Please "
  1077.              "read the Amiga FAQ for details."
  1078.         )
  1079.         (set done 1)
  1080.         ))
  1081.     ))
  1082.  
  1083.     (if (<> osHeadersDir "")
  1084.     (   (set osHeadersInstallStyle (askchoice
  1085.         (prompt "How should I install the OS headers?")
  1086.         (choices "Modify specs file"
  1087.              "Create environment variables"
  1088.              "None of the above"
  1089.         )
  1090.         (help
  1091.         "The OS headers can be installed in different ways.\n\n"
  1092.               "The simplest and safest is to copy them to "
  1093.               (tackon installDir "os-include") ".\n\n"
  1094.               "Another possibility would be to setup certain "
  1095.               "environment variables, so that gcc will always "
  1096.               "look into " osHeadersDir "when searching header "
  1097.               "files.\n\n"
  1098.               "The same result is accomplished by modifying the "
  1099.               "so-called specs file. This is the recommended "
  1100.               "method, although it is less visible for the user.\n\n"
  1101.               @askchoice-help
  1102.         )
  1103.         (default 0)
  1104.         ))
  1105.  
  1106.         (if (< osHeadersInstallStyle 2)
  1107.         (   (if (askbool
  1108.             (prompt "Do you want to create a \"GNUINCLUDE\" assign?")
  1109.             (help "Many people like to have an assign "
  1110.                   "\"GNUINCLUDE:\" with the directories where gcc "
  1111.                   "should always look for header files. Select \"yes\","
  1112.                   "if you do.\n\n"
  1113.                   "Others don't want to have much assigns and prefer "
  1114.                   "to use the name " osHeadersDir " immediately.\n\n"
  1115.                   @askbool-help
  1116.             )
  1117.             (default 0)
  1118.             )
  1119.         (   (set useGNUINCLUDE 1)
  1120.         ))
  1121.  
  1122.         )
  1123.         (   (message "You can still use the OS headers, either by "
  1124.              "adding -I" osHeadersDir " to your gcc command "
  1125.              "line or by copying them to "
  1126.              (tackon installDir "os-include") ".\n\n"
  1127.              "Be sure, that you don't override gcc header "
  1128.              "files in the latter case, especially the "
  1129.              "proto directory might be overwritten."
  1130.         )
  1131.         ))
  1132.     ))
  1133.     (CompleteStep)
  1134.  
  1135.     (set osHeadersDirSelected 1)
  1136.     ))
  1137. )
  1138.  
  1139.  
  1140. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1141. ;;;
  1142. ;;;  CompleteStep procedure
  1143. ;;;
  1144. ;;;  Shows how much of the work is completed.
  1145. ;;;
  1146. ;;;  Uses: completeLevel        Percent of work already done
  1147. ;;;        completeIncrement    Percent to add for this step
  1148. ;;;
  1149. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1150. (procedure CompleteStep
  1151.  
  1152.     (set completeLevel (+ completeLevel completeIncrement))
  1153.     (complete completeLevel)
  1154. )
  1155.  
  1156.  
  1157. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1158. ;;;
  1159. ;;;  UnpackArchives procedure
  1160. ;;;
  1161. ;;;  Allows the user to select and unpack LhA archives.
  1162. ;;;
  1163. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1164. (procedure UnpackArchives
  1165.  
  1166.     (SelectVersion)
  1167.     (Ask020Binaries)
  1168.  
  1169.     (if (askbool
  1170.         (prompt "\n\nShould I unpack the archives for you?")
  1171.         (help "GNU C is distributed in different archives. These "
  1172.           "must be unpacked using the program LhA. We'll do "
  1173.           "this now in case you didn't already."
  1174.         )
  1175.         (default 1)
  1176.     )
  1177.     (   (SelectLHAProgram)
  1178.  
  1179.     (SelectPackages)
  1180.     (CompleteStep)
  1181.  
  1182.     (set @Default-Archive-Path "")
  1183.     (if (<> (substr installDirParent (- (strlen installDirParent) 1)) ":")
  1184.     (   (set installDirParent (cat installDirParent "/"))
  1185.     ))
  1186.     (set lhaCommand (cat lhaProgram " x -q -I \"%s\" " installDirParent))
  1187.  
  1188.     (set n 0)
  1189.     (set bit 1)
  1190.     (while (set installArchiveName (select n "base"
  1191.                          "inclib"
  1192.                          (cat "c" install020)
  1193.                          (cat "c++" install020)
  1194.                          (cat "objc" (substr install020 1))
  1195.                          "utils"
  1196.                          "doc"
  1197.                          "utildoc"
  1198.                          "diffs"
  1199.                          "texi"
  1200.                          ""
  1201.        ))
  1202.     (   (set installArchiveName (cat installName installVersionShort "-"
  1203.                      installArchiveName ".lha"))
  1204.         (if (BITAND gnuPackagesChoice bit)
  1205.         (   (UnpackArchive)
  1206.         ))
  1207.         (CompleteStep)
  1208.         (set bit (shiftleft bit 1))
  1209.         (set n (+ n 1))
  1210.     ))
  1211.     )
  1212.     (   (set completeLevel (+ completeLevel (* completeIncrement 10)))
  1213.     (CompleteStep)
  1214.     ))
  1215. )
  1216.  
  1217.  
  1218. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1219. ;;;
  1220. ;;;  ActionInstallation procedure
  1221. ;;;
  1222. ;;;  Executes the work which is unique for installing a new package:
  1223. ;;;  Unpacking the archive and renaming 020 binaries.
  1224. ;;;
  1225. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1226. (procedure ActionInstallation
  1227.  
  1228.     (SelectInstallDir)
  1229.     (UnpackArchives)
  1230.     (CreateNeededLinks)
  1231.     (Rename020Binaries)
  1232. )
  1233.  
  1234.  
  1235. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1236. ;;;
  1237. ;;;  ActionDeinstallation procedure
  1238. ;;;
  1239. ;;;  performs all steps needed for deinstalling an existing package.
  1240. ;;;
  1241. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1242. (procedure ActionDeinstallation
  1243.  
  1244.     (SelectDeinstallDir)
  1245.     (DeinstallGNU)
  1246. )
  1247.  
  1248.  
  1249. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1250. ;;;
  1251. ;;;  ActionConfiguration procedure
  1252. ;;;
  1253. ;;;  performs all steps needed for configuring an existing package.
  1254. ;;;
  1255. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1256. (procedure ActionConfiguration
  1257.  
  1258.     (SelectInstallDir)
  1259.     (CopyEnvironment)
  1260.     (SelectOSHeadersDir)
  1261.     (ModifyUserStartup)
  1262.     (CompleteStep)
  1263. )
  1264.  
  1265.  
  1266. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1267. ;;;
  1268. ;;;   main program
  1269. ;;;
  1270. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1271.  
  1272. (CheckOsVersion)
  1273. (ShowCopyrightMessage)
  1274.  
  1275. (CheckGNUDir)
  1276.  
  1277. (if oldInstallationSeen
  1278. (   (complete 0)
  1279.  
  1280.     (set repeatIt 1)
  1281.     (set defaultChoice 3)
  1282.     (while repeatIt
  1283.     (   (set actionChoice (askchoice
  1284.         (prompt "Please select actions to perform.")
  1285.         (help "Select \"Deinstall existing version\", if you want "
  1286.           "to remove an existing package.\n\n"
  1287.           "Select \"Install new version\", if you want to "
  1288.           "replace the existing version with a new version."
  1289.           "Installing a new version implies reconfiguring it "
  1290.           "later.\n\n"
  1291.           "Select \"Configure existing version\", if you don't "
  1292.           "want to install a new version and just reconfigure "
  1293.           "an existing version.\n\n"
  1294.           "Select \"Done\", if you want to exit.\n\n"
  1295.           @askchoices-help
  1296.         )
  1297.         (choices "Deinstall existing version."
  1298.              "Install and configure new version"
  1299.              "Configure existing version"
  1300.              "All of the above"
  1301.              "Done"
  1302.         )
  1303.         (default defaultChoice)
  1304.     ))
  1305.  
  1306.     (set installDirAsked 0)
  1307.     (set asked020Binaries 0)
  1308.     (set askedInstallVersion 0)
  1309.     (set osHeadersDirSelected 0)
  1310.  
  1311.     (select actionChoice
  1312.     (   (set completeLevel 1)
  1313.         (set completeIncrement 33)
  1314.         (ActionDeinstallation)
  1315.         (set defaultChoice 1)
  1316.     )
  1317.     (   (set completeLevel -5)
  1318.         (set completeIncrement 5)
  1319.         (ActionInstallation)
  1320.         (ActionConfiguration)
  1321.         (set defaultChoice 4)
  1322.     )
  1323.     (   (set completeLevel 0)
  1324.         (set completeIncrement 20)
  1325.         (set configSubDir 1)
  1326.         (ActionConfiguration)
  1327.         (set configSubDir 0)
  1328.         (set defaultChoice 4)
  1329.     )
  1330.     (   (set completeLevel 4)
  1331.         (set completeIncrement 4)
  1332.         (ActionDeinstallation)
  1333.         (ActionInstallation)
  1334.         (ActionConfiguration)
  1335.         (set defaultChoice 4)
  1336.     )
  1337.     (   (set repeatIt 0)
  1338.     ))
  1339.     ))
  1340. )
  1341. (   (set completeLevel 0)
  1342.     (set completeIncrement 5)
  1343.  
  1344.     (message "GNU C is completely installed in one directory called GNU. "
  1345.          "Typical places are Work:GNU or similar.\n\n"
  1346.          "We start with selecting the parent directory of GNU, "
  1347.          "so that I can unarchive the LhA files to this place.\n"
  1348.          "An assign GNU: will lead to this directory later, binaries "
  1349.          "will be in GNU:bin, link libraries in GNU:lib and so on.\n\n"
  1350.          "If you have any problems with this installation script, send "
  1351.          "mail to\n"
  1352.          "jochen.wiedmann@zdv.uni-tuebingen.de"
  1353.     )
  1354.  
  1355.     (ActionInstallation)
  1356.     (ActionConfiguration)
  1357.  
  1358.     (message "Initial installation done. You may rerun me at any time "
  1359.          "to perform deinstallation, installing new versions or "
  1360.          "reconfiguring the existing package.\n\n"
  1361.          "Now you have to reboot to activate new environment.\n"
  1362.          "In case of errors, problems or whatever, please contact "
  1363.          "me at:\n\n"
  1364.          "email: phb@colombo.telesys-innov.fr\n"
  1365.          "fidonet: 2:320/104.21 Ramses The Amiga Flying BBS"
  1366.     )
  1367. ))
  1368.